package com.zte.shopping.interceptor;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * @program: ssm
 * @description: 拦截 身份验证
 * @author: zxb
 * @create: 2020-06-22 16:33
 **/
public class SysInterceptor extends HandlerInterceptorAdapter {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {//预处理
        //对url进行拦截，身份验证
        HttpSession session = request.getSession();
//        Admin admin = (Admin) session.getAttribute("admin");

//        if(admin!=null){
//            return true;//登录用户存在放行
//        }else {
//            request.getRequestDispatcher("/401.jsp").forward(request,response);
//            return false ;
//        }

        return true;
    }
}
